<?
$smarty->registerPlugin("function","_block", "loadBlock");

function loadBlock($params, $smarty)
{
	$q=query("select * from block where code='$params[code]'");
	
	if(numrows($q)==0) return;
	$r=fetch($q);
	if($r["type"]=="html")
		echo $r["content"];
	elseif($r["type"]=="php")
		include(BLOCK.$r["content"]);
}
?>